package com.gzsxy.esjy.service.netty.fileServer.configure;

import com.gzsxy.esjy.configuration.NettyServerConfig;
import com.gzsxy.esjy.service.netty.decoder.FileDownloadDecoder;
import com.gzsxy.esjy.service.netty.service.FileDownLoadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangxiaolong
 * @date 2022/7/11 9:36
 */
@Configuration
public class FileServerConfig {

    @Autowired
    private FileDownLoadService fileOperateService ;

    /**
     * 增加文件下载解码器
     * @return
     */
    @Bean
    public NettyServerConfig nettyServerConfig() {
        NettyServerConfig config = new NettyServerConfig() ;
        config.addDecoder(new FileDownloadDecoder(fileOperateService));
        return config;

    }
}
